package vp.remedies.dr.home.utils;

import java.lang.reflect.Modifier;
import java.text.SimpleDateFormat;
import java.util.Date;

import android.app.Activity;
import android.content.Intent;

/**
 * Utility is a just an ordinary class to have some Utility methods
 * 
 * @author Paresh Vasani
 * 
 */

public class Utility {

	public static void startNewActivity(Activity context, Class activityClass) {
		Intent intent = new Intent(context.getApplicationContext(),
				activityClass);
		// Close all views before launching Dashboard
		intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
		context.startActivity(intent);
	}

	public static boolean isInaccessible(int modifiers) {
		return !Modifier.isPublic(modifiers) || Modifier.isStatic(modifiers)
				|| Modifier.isFinal(modifiers)
				|| Modifier.isTransient(modifiers);
	}


	public static String getFormatedDate(Date date, String format) {
		SimpleDateFormat sdf = new SimpleDateFormat(format);
		return sdf.format(date);
	}

}
